home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Interactive Web Graphics with Shout 3D
/
Interactive Web Graphics With Shout 3D.iso
/
mac
/
Shout3Ddemo
/
S3D_2E1.exe
/
Shout3d_runtime
/
codebase
/
custom_nodes
/
InvertSceneEffect.java
< prev
next >
Wrap
Text File
|
2000-09-21
|
1KB
|
38 lines
/**
Company: Eyematic Interfaces
Project: Shout3D 2.0 Sample Code
Class: InvertSceneEffect
Date: March 23, 2000
Description: A simple example of a PostRenderEffect that inverts the colors of the scene.
(C) Copyright Eyematic Interfaces, Inc. - 1997-2000 - All rights reserved
*/
package custom_nodes;
import shout3d.core.*;
import shout3d.*;
import java.awt.Graphics;
/**
* InvertSceneEffect
*
* @author Dave Westwood
*/
public class InvertSceneEffect extends PostRenderEffect {
/**
* Constructs a default InvertSceneEffect node.
*/
public InvertSceneEffect(){}
public void filter(Graphics offScreenGraphics, int surface_pixel_bits[], float z_buffer[], int deviceWidth, int deviceHeight){
if (surface_pixel_bits == null)
return;
for (int i=0;i<surface_pixel_bits.length;i++){
surface_pixel_bits[i] = 0xff000000 +
((255-((surface_pixel_bits[i]>>16)&0xff))<<16) + // invert red
((255-((surface_pixel_bits[i]>>8)&0xff))<<8) + // invert green
((255-((surface_pixel_bits[i])&0xff))); // invert blue
}
}
}